<div class="status container">
	<div class="panel panel-default serverInfo">
		<div class="panel-heading">Server Info</div>
		<div class="panel-body">
			<table class="table">
				<thead></thead>
				<tbody></tbody>
			</table>
		</div>
	</div>
	<div class="panel panel-default webModules">
		<div class="panel-heading">Web Modules</div>
		<div class="panel-body">
			<table class="table">
				<thead>
					<tr>
						<th>Path</th>
						<th>Name</th>
						<th>Description</th>
						<th>Version</th>
					</tr>
				</thead>
				<tbody></tbody>
			</table>
		</div>
	</div>
	<div class="panel panel-default license">
		<div class="panel-heading">License</div>
		<div class="panel-body">
			<p>Copyright (C) 2009-2019 BIMserver.org</p>
			
			<p>This program is free software: you can redistribute it and/or modify
			it under the terms of the GNU Affero General Public License as
			published by the Free Software Foundation, either version 3 of the
			License, or (at your option) any later version.</p>
			
			<p>This program is distributed in the hope that it will be useful,
			but WITHOUT ANY WARRANTY; without even the implied warranty of
			MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
			GNU Affero General Public License for more details.</p>
			
			<p>You should have received a copy of the GNU Affero General Public License
			along with this program.  If not, see <a href="http://www.gnu.org/licenses">http://www.gnu.org/licenses</a>.
			</p>
			
			<p>
			All source code can be found on <a href="https://github.com/opensourceBIM/BIMserver">GitHub</a>.
			</p>
		</div>
	</div>
	<div class="panel panel-default privacy">
		<div class="panel-heading">Privacy</div>
		<div class="panel-body"></div>
	</div>
</div>
<script>
function Status(cd, serverInfo) {
	var o = this;
	
	cd.find(".serverInfo table tbody").append("<tr><td>Status</td><td>" + serverInfo.serverState + "</td></tr>");
	cd.find(".serverInfo table tbody").append("<tr><td>Version</td><td>" + serverInfo.version.fullString + "</td></tr>");
	
	Global.api.call("PluginInterface", "listAllWebModules", {}, function(webModules){
		webModules.forEach(function(webModule){
			var tr = $("<tr>");
			cd.find(".webModules table tbody").append(tr);
			Global.api.call("PluginInterface", "getPluginDescriptor", {oid: webModule.pluginDescriptorId}, function(pluginDescriptor){
				var td = $("<td>");
				Global.api.call("PluginInterface", "getPluginBundleVersionById", {
					pbid: pluginDescriptor.pluginBundleVersionId
				}, function(pbv){
					td.append(pbv.version);
				});
				tr.append("<td><a href=\"apps/" + pluginDescriptor.identifier + "/\">" + pluginDescriptor.identifier + "</a></td>");
				tr.append("<td>" + pluginDescriptor.name + "</td>");
				tr.append("<td>" + pluginDescriptor.description + "</td>");
				tr.append(td);
			});
		});
	});
	
	$(".privacy .panel-body").load("privacy.html");
}
</script>